/**
 * 登录页js
 */
/* 检查cookie中是否存在保存的用户名和密码 */
var username = $.cookie("username");
var password = $.cookie("password");
var remember = $.cookie("remember");

if (username && password && remember && remember == 1) {
	$("#username").val(username);
	$("#password").val(password);
	$("input[type='checkbox']").prop('checked', true);
}

$("button[name='submit']").click(function() {
	// 校验账号
	var form_username = $("#username").val();
	var form_password = $("#password").val();
	if (form_username && form_password) {
		// 账号正确
		var checked = $("input[type='checkbox']").prop('checked');
		if (checked) {
			$.cookie("username", $("#username").val());
			$.cookie("password", $("#password").val());
			$.cookie("remember", 1);
		} else {
			$.cookie("username", null);
			$.cookie("password", null);
			$.cookie("remember", 0);
		}
	} else {

	}
});